package guava.collections;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.HashMultimap;
import org.junit.Test;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author jiangwz
 * @create 2022/3/10.
 */
public class Multimap {

    @Test
    public void testMap(){
        HashMultimap<String, Integer> multimap = HashMultimap.create();
        multimap.put("day",1);
        multimap.put("day",1);
        multimap.put("day",2);
        multimap.put("day",8);
        multimap.put("month",3);
        Set<Integer> day = multimap.get("day");
        System.out.println(day);
    }

    @Test
    public void testMap2(){
        ArrayListMultimap<String, Integer> multimap = ArrayListMultimap.create();
        multimap.put("day",1);
        multimap.put("day",1);
        multimap.put("day",2);
        multimap.put("day",8);
        multimap.put("month",3);
        List<Integer> list = multimap.get("day");
        Map<String, Collection<Integer>> stringCollectionMap = multimap.asMap();
    }
}
